﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BBPA.Admin.Controls
{
    public partial class DDL_Supplier : System.Web.UI.UserControl
    {
        /// <summary>
        /// CSS属性
        /// </summary>
        public string ClassName { get { return ddl1.CssClass; } set { ddl1.CssClass = value; } }
        /// <summary>
        /// 是否：需要“请选择”
        /// </summary>
        public bool NeedLeaderWork { get { return _NeedLeaderWork; } set { _NeedLeaderWork = value; } }
        private bool _NeedLeaderWork = false;
        /// <summary>
        /// 选中的值
        /// </summary>
        public string SelectedValue { get { return ddl1.SelectedValue; } set { _SelectedValue = value; ddl1.SelectedValue = value; } }
        private string _SelectedValue = "";
        BLL.V_Supplier bll = new BLL.V_Supplier();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                foreach (Model.V_Supplier supplier in bll.GetModelList("IsLock=0")) ddl1.Items.Add(new ListItem(supplier.Name, supplier.id.ToString()));
                if (NeedLeaderWork) ddl1.Items.Insert(0, new ListItem("请选择", "0"));

            } if (_SelectedValue != "") ddl1.SelectedValue = _SelectedValue;
        }
       

        
    }
    
}